#include "dialogdisteuclpoint.h"

DialogDistEuclPoint::DialogDistEuclPoint(QWidget *parent) :
    QDialog(parent)
{
    ui.setupUi(this);
}

DialogDistEuclPoint::DialogDistEuclPoint(QWidget *parent, QList<Image> listeImages, bool couranteEnGris) :
    QDialog(parent)
{
    int i, nbItem=0;

    ui.setupUi(this);

    correspondance = (int *) malloc(listeImages.size()*sizeof(int));

    for(i=0;i<listeImages.size();i++)
    {
        if(listeImages[i].estGris == couranteEnGris)
        {
            ui.comboBoxImage->addItem(QString((listeImages[i].getNom()).c_str()));
            correspondance[nbItem]=i;
            nbItem++;
        }
    }

    connect(ui.buttonBoxOkAnnuler, SIGNAL(accepted()), this, SLOT(validation()));
}

DialogDistEuclPoint::~DialogDistEuclPoint()
{

}

void DialogDistEuclPoint::validation()
{
    emit retourDialog(ui.spinBoxValeur->value(),correspondance[ui.comboBoxImage->currentIndex()]);
    accept();
}
